#pragma once
#include <memory>
#include <map>
#include <mutex>
#include "VEncoder.h"
namespace Media{
    //should get from video sdk
    class VEncoderManager{
    public:
        #define MAX_ENCODER_NUM 16
        using EncChannel = int;
        using EncEnabled = bool;
        using Ptr = std::shared_ptr<VEncoderManager>;
        static Ptr Instance();
        VEncoderManager();
        ~VEncoderManager();
        bool CreateEncoder(VEncoder::Ptr& ptr, const VEncoderConfig& config);
        bool ReleaseEncoder(const VEncoder::Ptr& ptr);
    
    private:
        bool getAvailableChannel(EncChannel& channel);
        std::map<EncChannel, EncEnabled> m_encoders;
        std::recursive_mutex m_mux;
    };
}